7. AR QR code

7.1. Overview

wiki: http://wiki.ros.org/ar_track_alvar/

Source code: https://github.com/ros-perception/ar_track_alvar.git

Feature pack location: ~/yahboomcar_ws/src/yahboomcar_visual

ARTag (AR tag, AR means "augmented reality") is a fiducial marker system, which can be understood as a reference for other objects. It looks similar to a two-dimensional code, but its encoding system and two-dimensional code are still very large. The difference is mostly used in camera calibration, robot positioning, augmented reality (AR) and other applications. One of the most important functions is to identify the pose relationship between the object and the camera. An ARTag can be attached to the object, or an ARTag label can be attached to a plane to calibrate the camera. After the camera recognizes the ARTag, the position and pose of the tag in the camera coordinates can be calculated.

ar_track_alvar has 4 main functions:

Alvar is newer and more advanced than ARToolkit, which has been the basis for several other ROS AR tagging packages. Alvar features adaptive thresholding to handle various lighting conditions, optical flow-based tracking for more stable pose estimation, and an improved label recognition method that does not slow down significantly as the number of labels increases.

7.2. Create ARTag

7.2.1. install software package

image-20210902154213121

ar_track_alvar is an open source marker library that provides examples of pr2+kinect. The first use case of this package is to recognize and track the pose of (potentially) multiple AR tags, each of which is considered individually.

7.2.2. Create AR QR code

image-20210902164850255

You can enter [ID] and location information here, and enter [-1] to end. One or more can be generated, and the layout can be designed by yourself.

image-20210902165006781

Command+parameters directly generate digital pictures; e.g.

11: The number is the QR code of 11. -s: Specifies the image size. 5: 5x5 picture. 33: The number is the QR code of 33.

7.3, ARTag identification

Note: When starting the camera, you need to load the camera calibration file, otherwise it will not be recognized.

7.3.1. Start the identification instance

image-20210902194448055

In rviz, you need to set the corresponding camera topic name.

7.3.2. launch file analysis

Node parameters:

7.3.3. ar_track_alvar node

topic nametype of data
/camera_info( sensor_msgs/CameraInfo )
/image_raw( sensor_msgs/Image )
topic nametype of data
/visualization_marker( visualization_msgs/Marker )
/ar_pose_marker( ar_track_alvar/AlvarMarkers )

A single QR code: camera coordinate system → AR tag coordinate system

Multiple QR Codes: Provides a transformation from the camera coordinate system to each AR marker coordinate system (named ar_marker_x), where x is the marker's ID number.

7.3.4. View node graph

image-20210902204026973

7.3.5. View tf tree

image-20210902203913123

Through rviz, we can intuitively see the relative position of the QR code and the camera. The camera and world coordinate system are set by themselves.

7.3.6. View output information

The display is as follows: